package com.tjsinfo.tjsoa.workplan.action;

import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.common.DateTimeFromConver;
import com.tjsinfo.tjsoa.system.vo.User;
import com.tjsinfo.tjsoa.workplan.vo.WorkPlanMain;

public class WorkPlanWeekModleUpAction extends WorkPlanMonthModleUp{
	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.workplan.action.WorkPlanMonthModleUp#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		try {
			
			User user = getUser(request);
			
			String datestr = request.getParameter("date");
			Date date =	DateTimeFromConver.datetostr(datestr);
			Map<Integer, WorkPlanMain> map = selectWork("W", user, date);
			return forword(mapping, request, date, map);
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.workplan.action.WorkPlanMonthModleDown#getDate(javax.servlet.http.HttpServletRequest)
	 */
	@Override
	protected Date getDate(HttpServletRequest request) {
		// TODO Auto-generated method stub
		String datestr = request.getParameter("date");
		Date date =	DateTimeFromConver.datetostr(datestr);
		return date;
	}
}
